
@extends('admin.master')

@section('title', '编辑账号')

@section('title_top')
    @parent
    <div class="title_top">编辑账号</div>
@stop
@section('equip_query')
<div class="title_edit">请按照提示填写信息</div>
@stop
@section('userinfo_tab')
<input type="hidden" value="{{ $adminInfo->id }}" class="userId" />
<div class="edit_gb">
	<div class="edit_box">
		<div>姓名<input class="name_edi" type="text" value="{{ $adminInfo->adminInfo->name or '' }}" /></div>
		<div class="sex_box">
			<p>性别</p>
			<p class="sex_input_box"><span class="sex_input sex_edit" >{{ $adminInfo->adminInfo->sex_description }}</span></p>
			<div class="sex_down sex_e">
				<a>男</a>
				<a>女</a>
			</div>
		</div>
		<div class="clear"></div>
		<div>手机<input class="telephe_t" type="text" value="{{ $adminInfo->adminInfo->phone or '' }}"/><label class="requiredCharacter">*</label></div>
		<div class="edit_btn">
			<a class="return_btn" href="javascript:history.go(-1);">返回</a>
			<a class="edit_submit">提交</a>
		</div>
	</div>
</div>

@stop
@section('infor_promit')
@parent
<script type="text/javascript">
	//编辑账户提交
	$(".edit_submit").click(function(){
	    editA();
	});
	function editA(){
		var aName=$(".name_edi").val();
	    var aSex=$(".sex_edit").html();
	    var aTel=$(".telephe_t").val();
	    var userId=$(".userId").val();
	    if(aTel==""){
	    	hint("手机号码不能为空！");
	    }else if(/^1[34578]\d{9}$/.test(aTel)){
	    	$.ajax({
		        url:"/api/admin/update",
		        type:"post",
		        dataType:"json",
		        data:{
		            userId:userId,
		            name:aName,
		            sex:aSex,
		            phone:aTel
		        },
		        success:function(data){
		            if(data.status['errCode'] == 0){
		                hint1("编辑成功！");
		                window.location.href='/admin/user/index';
		            }else{
		                hint(data.status.message);
		            }
		        }
		    });
	    }else{
	    	hint("手机号码输入有误，请正确输入！");
	    }
	    
	}

</script>
@stop
		
